package math;

public class ArithmeticError implements ArithmeticExpression {

  private String cause;
  
  private ArithmeticExpression sourceExpression;

  public ArithmeticError(String cause, ArithmeticExpression sourceExpression){
    this.cause = cause;
    this.sourceExpression = sourceExpression;
  }
  
  public String getCause() {
    return cause;
  }
  
  public ArithmeticExpression getSourceExpression() {
    return sourceExpression;
  }
  
  @Override
  public ArithmeticExpression derivate(Variable var) {
    return this;
  }

  @Override
  public int getPriority() {
    return 1;
  }

  @Override
  public boolean isOne() {
    return false;
  }

  @Override
  public boolean isZero() {
    return false;
  }

  @Override
  public ArithmeticExpression simplify() {
    return this;
  }

  @Override
  public <R> R accept(ExpressionVisitor<R> visitor) {
    return visitor.visitArithmeticError(this);
  }

  @Override
  public int countMembers() {
    return 1;
  }

  @Override
  public boolean matches(Expression expr) {
    if (expr instanceof ArithmeticError) {
      return true;
    } else
      return false;
  }
}